home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / ResultSetMetaData.java < prev    next >
Text File  |  1998-09-22  |  7KB  |  219 lines

  1. /*
  2.  * @(#)ResultSetMetaData.java    1.6 98/07/01
  3.  *
  4.  * Copyright 1995-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.sql;
  16.  
  17. /**
  18.  * A ResultSetMetaData object can be used to find out about the types 
  19.  * and properties of the columns in a ResultSet.
  20.  */
  21.  
  22. public interface ResultSetMetaData {
  23.  
  24.     /**
  25.      * What's the number of columns in the ResultSet?
  26.      *
  27.      * @return the number
  28.      * @exception SQLException if a database-access error occurs.
  29.      */
  30.     int getColumnCount() throws SQLException;
  31.  
  32.     /**
  33.      * Is the column automatically numbered, thus read-only?
  34.      *
  35.      * @param column the first column is 1, the second is 2, ...
  36.      * @return true if so
  37.      * @exception SQLException if a database-access error occurs.
  38.      */
  39.     boolean isAutoIncrement(int column) throws SQLException;
  40.  
  41.     /**
  42.      * Does a column's case matter?
  43.      *
  44.      * @param column the first column is 1, the second is 2, ...
  45.      * @return true if so
  46.      * @exception SQLException if a database-access error occurs.
  47.      */
  48.     boolean isCaseSensitive(int column) throws SQLException;    
  49.  
  50.     /**
  51.      * Can the column be used in a where clause?
  52.      *
  53.      * @param column the first column is 1, the second is 2, ...
  54.      * @return true if so
  55.      * @exception SQLException if a database-access error occurs.
  56.      */
  57.     boolean isSearchable(int column) throws SQLException;
  58.  
  59.     /**
  60.      * Is the column a cash value?
  61.      *
  62.      * @param column the first column is 1, the second is 2, ...
  63.      * @return true if so
  64.      * @exception SQLException if a database-access error occurs.
  65.      */
  66.     boolean isCurrency(int column) throws SQLException;
  67.  
  68.     /**
  69.      * Can you put a NULL in this column?        
  70.      *
  71.      * @param column the first column is 1, the second is 2, ...
  72.      * @return columnNoNulls, columnNullable or columnNullableUnknown
  73.      * @exception SQLException if a database-access error occurs.
  74.      */
  75.     int isNullable(int column) throws SQLException;
  76.  
  77.     /**
  78.      * Does not allow NULL values.
  79.      */
  80.     int columnNoNulls = 0;
  81.  
  82.     /**
  83.      * Allows NULL values.
  84.      */
  85.     int columnNullable = 1;
  86.  
  87.     /**
  88.      * Nullability unknown.
  89.      */
  90.     int columnNullableUnknown = 2;
  91.  
  92.     /**
  93.      * Is the column a signed number?
  94.      *
  95.      * @param column the first column is 1, the second is 2, ...
  96.      * @return true if so
  97.      * @exception SQLException if a database-access error occurs.
  98.      */
  99.     boolean isSigned(int column) throws SQLException;
  100.  
  101.     /**
  102.      * What's the column's normal max width in chars?
  103.      *
  104.      * @param column the first column is 1, the second is 2, ...
  105.      * @return max width
  106.      * @exception SQLException if a database-access error occurs.
  107.      */
  108.     int getColumnDisplaySize(int column) throws SQLException;
  109.  
  110.     /**
  111.      * What's the suggested column title for use in printouts and
  112.      * displays?
  113.      *
  114.      * @param column the first column is 1, the second is 2, ...
  115.      * @return true if so 
  116.      * @exception SQLException if a database-access error occurs.
  117.      */
  118.     String getColumnLabel(int column) throws SQLException;    
  119.  
  120.     /**
  121.      * What's a column's name?
  122.      *
  123.      * @param column the first column is 1, the second is 2, ...
  124.      * @return column name
  125.      * @exception SQLException if a database-access error occurs.
  126.      */
  127.     String getColumnName(int column) throws SQLException;
  128.  
  129.     /**
  130.      * What's a column's table's schema?
  131.      *
  132.      * @param column the first column is 1, the second is 2, ...
  133.      * @return schema name or "" if not applicable
  134.      * @exception SQLException if a database-access error occurs.
  135.      */
  136.     String getSchemaName(int column) throws SQLException;
  137.  
  138.     /**
  139.      * What's a column's number of decimal digits?
  140.      *
  141.      * @param column the first column is 1, the second is 2, ...
  142.      * @return precision
  143.      * @exception SQLException if a database-access error occurs.
  144.      */
  145.     int getPrecision(int column) throws SQLException;
  146.  
  147.     /**
  148.      * What's a column's number of digits to right of the decimal point?
  149.      *
  150.      * @param column the first column is 1, the second is 2, ...
  151.      * @return scale
  152.      * @exception SQLException if a database-access error occurs.
  153.      */
  154.     int getScale(int column) throws SQLException;    
  155.  
  156.     /**
  157.      * What's a column's table name? 
  158.      *
  159.      * @return table name or "" if not applicable
  160.      * @exception SQLException if a database-access error occurs.
  161.      */
  162.     String getTableName(int column) throws SQLException;
  163.  
  164.     /**
  165.      * What's a column's table's catalog name?
  166.      *
  167.      * @param column the first column is 1, the second is 2, ...
  168.      * @return column name or "" if not applicable.
  169.      * @exception SQLException if a database-access error occurs.
  170.      */
  171.     String getCatalogName(int column) throws SQLException;
  172.  
  173.     /**
  174.      * What's a column's SQL type?
  175.      *
  176.      * @param column the first column is 1, the second is 2, ...
  177.      * @return SQL type
  178.      * @exception SQLException if a database-access error occurs.
  179.      * @see Types
  180.      */
  181.     int getColumnType(int column) throws SQLException;
  182.  
  183.     /**
  184.      * What's a column's data source specific type name?
  185.      *
  186.      * @param column the first column is 1, the second is 2, ...
  187.      * @return type name
  188.      * @exception SQLException if a database-access error occurs.
  189.      */
  190.     String getColumnTypeName(int column) throws SQLException;
  191.  
  192.     /**
  193.      * Is a column definitely not writable?
  194.      *
  195.      * @param column the first column is 1, the second is 2, ...
  196.      * @return true if so
  197.      * @exception SQLException if a database-access error occurs.
  198.      */
  199.     boolean isReadOnly(int column) throws SQLException;
  200.  
  201.     /**
  202.      * Is it possible for a write on the column to succeed?
  203.      *
  204.      * @param column the first column is 1, the second is 2, ...
  205.      * @return true if so
  206.      * @exception SQLException if a database-access error occurs.
  207.      */
  208.     boolean isWritable(int column) throws SQLException;
  209.  
  210.     /**
  211.      * Will a write on the column definitely succeed?    
  212.      *
  213.      * @param column the first column is 1, the second is 2, ...
  214.      * @return true if so
  215.      * @exception SQLException if a database-access error occurs.
  216.      */
  217.     boolean isDefinitelyWritable(int column) throws SQLException;
  218. }
  219.